package it.mercatino.command;

/**
 * Comando per l'invio di una e-mail.<br>
 * Usa un oggetto EmailSender come receiver.
 * 
 * @author Luvi
 *
 */
public class SendEmail implements Command {
	
	private EmailSender sender;

	private String host;
	private String from;
	private String to;
	private String subject;
	private String text;
	
	public SendEmail(EmailSender sender) {
		
		host = "cabis.unile.it"; // "mail.tin.it"; //"mailing.unile.it";//"ilenic.unile.it"; //"mail.libero.it";
		from = "nienteDiNuovo@nienteDiNuovo.it";
		to = "luvibruno@libero.it";
		this.sender = sender;
			
	}
	
	public void execute() {
		
		sender.inviaEmail(host, from, to, subject, text);
		
	}

	/**
	 * @return the sender
	 */
	public EmailSender getSender() {
		return sender;
	}

	/**
	 * @param sender the sender to set
	 */
	public void setSender(EmailSender sender) {
		this.sender = sender;
	}

	/**
	 * @return the host
	 */
	public String getHost() {
		return host;
	}

	/**
	 * @param host the host to set
	 */
	public void setHost(String host) {
		this.host = host;
	}

	/**
	 * @return the from
	 */
	public String getFrom() {
		return from;
	}

	/**
	 * @param from the from to set
	 */
	public void setFrom(String from) {
		this.from = from;
	}

	/**
	 * @return the to
	 */
	public String getTo() {
		return to;
	}

	/**
	 * @param to the to to set
	 */
	public void setTo(String to) {
		this.to = to;
	}

	/**
	 * @return the subject
	 */
	public String getSubject() {
		return subject;
	}

	/**
	 * @param subject the subject to set
	 */
	public void setSubject(String subject) {
		this.subject = subject;
	}

	/**
	 * @return the text
	 */
	public String getText() {
		return text;
	}

	/**
	 * @param text the text to set
	 */
	public void setText(String text) {
		this.text = text;
	}
}